home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-10-25 | 4.4 KB | 171 lines | [TEXT/MPS ] |
- // Copyright © 1995 Apple Computer, Inc. All rights reserved.
- // Release Version: $ 1.0 d11 $
-
- //================================================================================
- #ifndef DATASAVEPRT_H
- #include "DataSavePrt.h" // CDataSavePart
- #endif
-
- #ifndef _DATASAVEFRAME_
- #include "DataSaveFrm.h" // CDataSaveFrame
- #endif
-
- #ifndef PIZZA_H
- #include "Pizza.h" // CPizza
- #endif
-
- #ifndef CONSTANT_H
- #include "Constant.h" // my menu command numbers
- #endif
-
- // --- DU Selection FW ---------------------
- #ifndef DUSELECTABLE_H
- #include "DUSelectable.h" // DU_MSelectable
- #endif
-
- #ifndef DULIST_H
- #include "DUList.h" // DU_CList
- #endif
-
- #ifndef DULISTSELECTION_H
- #include "DUListSelection.h" // DU_CListSelection
- #endif
-
- // ----- Framework Layer -----
- #ifndef FWPRESEN_H
- #include "FWPresen.h" // FW_CPresentation
- #endif
-
- #ifndef FWUTIL_H
- #include "FWUtil.h" // FW_Beep()
- #endif
-
- #ifndef FWMEMMGR_H
- #include "FWMemMgr.h" // FW_CMemoryManager
- #endif
-
- // ----- OS Layer -----
- #ifndef FWRESFIL_H
- #include "FWResFil.h" // FW_CResourceFile
- #endif
-
- #ifndef FWCFMRES_H
- #include "FWCFMRes.h" // FW_CSharedLibraryResourceFile
- #endif
-
- #ifndef FWEVENT_H
- #include "FWEvent.h" // FW_CMenuEvent
- #endif
-
- #ifndef FWSUSINK_H
- #include "FWSUSink.h" // FW_CStorageUnitSink
- #endif
-
- // ----- Foundation Layer -----
- #ifndef FWSTREAM_H
- #include <FWStream.h> // FW_InitializeArchiving
- #endif
-
- #ifndef FWSTRGAR_H
- #include "FWStrgAr.h" // FW_CStringArchiver
- #endif
-
- #ifndef FWMEMMGR_H
- #include "FWMemMgr.h" // FW_CMemoryManager
- #endif
-
- #include "FWARDyna.h"
-
- // ----- OpenDoc Includes --------------
- #ifndef SOM_Module_OpenDoc_StdProps_defined
- #include <StdProps.xh> // kODPropContents
- #endif
-
-
- //==============================================================================
- const ODValueType CDataSavePart::kPartKind = kDataSaveKind;
- const ODValueType CDataSavePart::kPartUserName = kDataSaveEditorUserString;
-
- #define kMainPresentation "Apple:Presentation:DataSave"
-
- #ifdef FW_BUILD_MAC
- #pragma segment DataSave
- #endif
-
- //==============================================================================
- CDataSavePart::CDataSavePart(ODPart* odPart)
- : DU_CListPart(odPart, kPartKind, kPartUserName, FW_gInstance, kPartIconID),
- fPresentation(NULL)
- {
- }
-
- //--------------------------------------------------------------------------------
- void
- CDataSavePart::Initialize(Environment* ev) // Override
- {
- DU_CListPart::Initialize(ev);
- const FW_Boolean kDefaultPresentation = TRUE;
- fPresentation = this->RegisterPresentation(ev,
- kMainPresentation,
- kDefaultPresentation,
- new DU_CListSelection(ev, this));
- this->MyInitMenus(ev);
-
- // need this for parts that externalize data
- FW_InitializeArchiving(FW_gInstance);
- }
-
- //--------------------------------------------------------------------------------
- CDataSavePart::~CDataSavePart()
- {
- }
-
- //--------------------------------------------------------------------------------
- void
- CDataSavePart::MyInitMenus(Environment* ev)
- {
- FW_CSharedLibraryResourceFile resFile;
- FW_CPullDownMenu* pizzaMenu = new FW_CPullDownMenu(ev, resFile, kMenuStringsResID,
- kPizzaMenuStringID);
- pizzaMenu->AppendTextItem(ev, resFile, kMenuStringsResID,
- kItemOneStringID, cSelectPizzaCmd, '1');
- pizzaMenu->AppendSeparator(ev);
- pizzaMenu->AppendTextItem(ev, resFile, kMenuStringsResID,
- kItemTwoStringID, cMakePizzaCmd, '2');
- this->GetMenuBar(ev)->AdoptMenuLast(ev, pizzaMenu);
- }
-
- //--------------------------------------------------------------------------------
- FW_CFrame*
- CDataSavePart::NewFrame(Environment* ev, ODFrame* odFrame,
- FW_CPresentation* presentation, FW_Boolean fromStorage) // Override
- {
- FW_UNUSED(presentation);
- FW_UNUSED(fromStorage);
- return new CDataSaveFrame(ev, odFrame, presentation, this);
- }
-
- //--------------------------------------------------------------------------------
- void
- CDataSavePart::MyInvalidatePresentation(Environment* ev, FW_CRect& invalidRect)
- {
- fPresentation->Invalidate(ev, invalidRect);
- }
-
- //--------------------------------------------------------------------------------
- void
- CDataSavePart::MyAddPizza(Environment* ev, CPizza* pizza)
- {
- this->AddItem(ev, pizza);
- this->MyInvalidatePresentation(ev, pizza->GetBounds() );
- }
-
- //--------------------------------------------------------------------------------
- void
- CDataSavePart::MyRemovePizza(Environment* ev, CPizza* pizza)
- {
- this->RemoveItem(ev, pizza);
- this->MyInvalidatePresentation(ev, pizza->GetBounds() );
- delete pizza;
- }
-